package cn.wolfcode.wolf2w.controller;

import cn.wolfcode.wolf2w.domain.Banner;
import cn.wolfcode.wolf2w.service.IBannerService;
import cn.wolfcode.wolf2w.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("index")
public class IndexController {

    @Autowired
    private IBannerService bannerService;


    /**
     * 前五的攻略 banner
     * @return
     */
    @GetMapping("/banners/strategy")
    public Object getStrategy(){

        List<Banner> strategiesTop5 =  bannerService.queryStrategiesOrderBySequence();

        return JsonResult.success(strategiesTop5);
    }

    /**
     * 前五的游记 banner
     * @return
     */
    @GetMapping("/banners/travel")
    public Object getTravel(){

        List<Banner> travelTop5 =  bannerService.queryTravelOrderBySequence();

        return JsonResult.success(travelTop5);
    }

}
